<?php
/**
 *
 * @authors nideer (netbite@163.com)
 * @date    2017-05-02 14:04:22
 * @link    php.nideer.com
 * @Copyright $Id$
 */

$pdo = new mysqli('localhost','root','root',$this->dbName);;

$pdo ->query('set names utf8');

$redis = new redis();
$redis ->connect('localhost',6379);


//标签数据写入redis
$bookid = $redis ->incr('global:bookid');
$sql = "insert into bok values ($bookid {$_POST['title']})";
$pdo ->query($sql);


//书籍数据写入mysql
$tags= trim($_POST['tags'],',');
$tags = explode(',', $bookid);

foreach ($tags as $tag) {
	$redis -> sAdd(trim($tag),$tag);
}
echo 'ok';
